<!DOCTYPE html>
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=90327">bug 90327</a>:
webkitCancelFullScreen for iframes</p>
<p>To test manually, click the "Go full screen" button - the page should enter full screen mode and immediately exit again, without crashing.</p>
<script src="full-screen-test.js"></script>
<script>
function runTest() {
    var frame = document.getElementById('frame');

    waitForEventOnce(frame.contentDocument, 'webkitfullscreenchange', function() {
        test("document.getElementById('frame').contentDocument.webkitIsFullScreen==true")
        waitForEventOnce(frame.contentDocument, 'webkitfullscreenchange', function() {
            test("document.getElementById('frame').contentDocument.webkitIsFullScreen==false")
            endTest();
        });

        document.webkitCancelFullScreen();
    });

    var x = frame.getBoundingClientRect().left + 10;
    var y = frame.getBoundingClientRect().top + 10;
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    eventSender.mouseUp();
}
</script>
<iframe id="frame" src="resources/inner.html" width="300" height="100" onload="runTest()" allowfullscreen>
</iframe>
